//
//  ZJFSecondHeaderCollectionReusableView.m
//  OurTourism
//
//  Created by 张金峰 on 15/11/27.
//  Copyright © 2015年 Devil_Coming. All rights reserved.
//

#import "ZJFSecondHeaderCollectionReusableView.h"
#import "Masonry.h"
@interface ZJFSecondHeaderCollectionReusableView ()

@property (nonatomic, retain)UILabel *blueLable;
@property (nonatomic, retain)UILabel *titleLable;
@property (nonatomic, retain)UIView *aview;
@end
@implementation ZJFSecondHeaderCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView
{
//    self.backImg = [[UIImageView alloc] init];
//    self.backImg.backgroundColor = [UIColor redColor];
//    [self addSubview:self.backImg];
//    
    self.aview = [[UIView alloc] init];
    self.aview.backgroundColor = [UIColor colorWithRed:250 / 255. green:246 / 255. blue:232 / 255. alpha:1];
    [self addSubview: self.aview];
    
    self.blueLable = [[UILabel alloc]init];
    self.blueLable.backgroundColor = [UIColor colorWithRed:0.26 green:0.55 blue:0.58 alpha:1];

    [self.aview addSubview: self.blueLable];
    
    self.titleLable = [[UILabel alloc]init];
    self.titleLable.font = [UIFont boldSystemFontOfSize:22];

    self.titleLable.textColor = [UIColor darkGrayColor];
    self.titleLable.text =  @"精彩攻略";
    [self.aview addSubview:self.titleLable];
    
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    
//    [self.backImg mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.mas_top).offset(-200);
//        make.left.mas_equalTo(self.mas_left).offset(0);
//        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, 200));
//    }];
    self.aview.layer.cornerRadius = 15;
    self.aview.layer.masksToBounds = YES;
    self.blueLable.layer.cornerRadius = 3;
    self.blueLable.layer.masksToBounds = YES;
    
    [self.aview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(-20);
        make.left.mas_equalTo(self.mas_left).offset(0);
        make.size.mas_equalTo(CGSizeMake(self.frame.size.width, self.frame.size.height + 20));
        }];
    
     [self.blueLable mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(self.aview.mas_top).offset(40);
         make.left.mas_equalTo(self.aview.mas_left).offset(10);
         make.size.mas_equalTo(CGSizeMake(10, 30));
     }];
    [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.aview.mas_top).offset(29);
        make.left.mas_equalTo(self.aview.mas_left).offset(24);
        make.size.mas_equalTo(CGSizeMake(120, 50));
    }];
    
  //  self.blueLable.frame = CGRectMake(10, 20 , 5, 24);

   // self.titleLable.frame = CGRectMake(25, _blueLable.frame.origin.y, self.frame.size.width - 25 - 200, _blueLable.frame.size.height);
}


@end
